<template>
    <div class="edu-page-warp">
        <InnerBreadcrumb v-model="indexKey" :path="breadPath" :showBack="true" />
        <div v-show="indexKey == '1'" class="condition">
            <condition-card
                @reset="reset"
                @search="onSubmit"
                label-width="110px"
                :expand="isStudent?false:true"
                :advance="true"
                businessType="stuInfoCheckManage"
                fieldsApi="/api/studentservice/advancedQuery/findFieldInfo"
                searchApi="/api/studentservice/advancedQuery/findResultList"
                searchApiMethod="post"
                @advanceQuery="advanceQuery"
            >
                <el-row :gutter="24">
                    <el-col :span="8">
                        <el-form-item :label="$t('label.grade')">
                            <el-date-picker
                                clearable
                                v-model="queryForm.grade"
                                value-format="yyyy"
                                type="year"
                                placeholder="请选择"
                                style="width: 100%"
                                @change="currentDptId === '1' ? changeFaculty() : ''"
                            />
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item :label="$t('label.college')">
                            <el-select
                                clearable
                                v-model="queryForm.facultyList"
                                multiple
                                collapse-tags
                                style="width: 100%;height:33px"
                                @change="changeFaculty"
                                filterable
                            >
                                <el-option
                                    v-for="item in options.college"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value"
                                />
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <!-- <el-col :span="8" v-if="showSchool">
                        <el-form-item :label="$t('school.school')">
                            <el-select v-model="queryForm.schoolId" style="width:100%" clearable>
                                <el-option
                                    v-for="item in options.school"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value"
                                />
                            </el-select>
                        </el-form-item>
                    </el-col> -->
                    <el-col :span="8">
                        <el-form-item :label="$t('label.major')">
                            <el-select
                                v-model="queryForm.professionList"
                                style="width:100%;height:33px"
                                clearable
                                multiple
                                collapse-tags
                            >
                                <el-option
                                    v-for="item in options.major"
                                    :key="item.value"
                                    :label="item.label+'('+item.value+')'"
                                    :value="item.value"
                                />
                            </el-select>
                        </el-form-item>
                    </el-col>
                    </el-row>   
                    <el-row :gutter="24">
                    <el-col :span="8">
                        <el-form-item :label="$t('label.trainingLevel')">
                            <el-select
                                clearable
                                v-model="queryForm.trainingLevelList"
                                multiple
                                collapse-tags
                                style="width: 100%;"
                            >
                                <el-option
                                    v-for="item in options.trainingLevel"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value"
                                />
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item :label="$t('label.trainingCategory')">
                            <el-select
                                v-model="queryForm.trainingCategory"
                                style="width: 100%;"
                                clearable
                            >
                                <el-option
                                    v-for="item in options.trainingCategory"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value"
                                />
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item :label="$t('dic.degreeType')">
                            <el-select
                                clearable
                                v-model="queryForm.degreeType"
                                style="width: 100%"
                                @change="currentDptId !== '1' ? changeFaculty() : ''"
                            >
                                <el-option
                                    v-for="item in options.degreeType"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value"
                                />
                            </el-select>
                        </el-form-item>
                    </el-col>
                    </el-row> 
                    <el-row :gutter="24">
                    <el-col :span="8">
                        <el-form-item :label="$t('label.formLearning')">
                            <el-select
                                v-model="queryForm.formLearning"
                                style="width: 100%;"
                                clearable
                            >
                                <el-option
                                    v-for="item in options.formLearning"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value"
                                />
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item :label="$t('label.enrolMethod')">
                            <el-select
                                v-model="queryForm.enrolMethods"
                                style="width: 100%;"
                                clearable
                            >
                                <el-option
                                    v-for="item in options.enrolMethods"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value"
                                />
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8">
                        <el-form-item :label="$t('label.isOverseas')">
                            <el-select
                                v-model="queryForm.isOverseas"
                                style="width: 100%;"
                                clearable
                            >
                                <el-option
                                    v-for="item in options.isOverseas"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value"
                                />
                            </el-select>
                        </el-form-item>
                    </el-col>
                    </el-row> 
                    <el-row :gutter="24">
                    <el-col :span="8" :default="isStudent?true:null">
                        <el-form-item label="审核状态">
                            <el-select
                                v-model="queryForm.approStatus"
                                style="width: 100%;"
                                clearable
                            >
                                <el-option
                                    v-for="item in options.approStatus"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value"
                                />
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8" :default="isStudent?true:null">
                        <el-form-item label="变更类型">
                            <el-select
                                v-model="queryForm.fieldClass"
                                style="width: 100%;"
                                clearable
                                @change="handleFieldClassChange"
                            >
                                <el-option
                                    v-for="item in options.fieldClass"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value"
                                />
                            </el-select>
                        </el-form-item>
                    </el-col>
                    <el-col :span="8" :default="isStudent?true:null">
                        <el-form-item label="申请字段">
                            <el-select
                                v-model="queryForm.fieldId"
                                style="width: 100%;"
                                clearable
                                filterable
                            >
                                <el-option
                                    v-for="item in options.fields"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value"
                                />
                            </el-select>
                        </el-form-item>
                    </el-col>
                    </el-row> 
                    <el-row :gutter="24">
                    <el-col :span="8">
                        <el-form-item label="申请类型">
                            <el-select v-model="queryForm.appliType" style="width: 100%;" clearable>
                                <el-option
                                    v-for="item in options.appliType"
                                    :key="item.value"
                                    :label="item.label"
                                    :value="item.value"
                                />
                            </el-select>
                        </el-form-item>
                    </el-col>
                </el-row>
            </condition-card>
            <el-card shadow="never">
                <div class="edu-page-title">信息变更管理</div>
                <el-row>
                    <el-col :span="4">
                        <el-input
                            v-model="queryForm.keyWord"
                            :placeholder="$t('score.failScoreManage.pleaseInt')"
                            @keyup.enter.native="onSubmit"
                            style="width:200px"
                        >
                            <i
                                class="el-icon-search"
                                slot="suffix"
                                style="margin-top:10px;cursor:pointer"
                                @click="onSubmit"
                            ></i>
                        </el-input>
                    </el-col>
                    <el-col :span="6">
                        <div class="empty-box" />
                    </el-col>
                    <el-col :span="14">
                        <div class="float-right">
                            <el-button v-if="showApproveBtn" @click="approve">审核</el-button>
                            <el-button
                                type="primary"
                                @click="exportStudents"
                            >{{$t('message.export')}}</el-button>
                        </div>
                    </el-col>
                </el-row>
                <edu-table
                    :data="students"
                    size="mini"
                    style="width:100%"
                    :order="false"
                    @page-change="handleCurrentChange"
                    :total="queryForm.total_"
                    :pageSize="queryForm.pageSize_"
                    :pageNum="queryForm.pageNum_"
                    @selection-change="selectionChange"
                >
                    <el-table-column
                        :label="$t('label.stuCode')"
                        prop="studentId"
                        fixed
                        show-overflow-tooltip
                        width="100"
                    ></el-table-column>
                    <el-table-column
                        :label="$t('label.stuName')"
                        prop="name"
                        fixed
                        show-overflow-tooltip
                    ></el-table-column>
                    <el-table-column label="变更类型" show-overflow-tooltip width="140">
                        <template slot-scope="scope">{{ scope.row.fieldClassName }}</template>
                    </el-table-column>
                    <el-table-column label="申请类型" prop="appliTypeI18n" width="140"></el-table-column>
                    <el-table-column label="申请字段" show-overflow-tooltip width="140">
                        <template slot-scope="scope">{{ scope.row.fieldName }}</template>
                    </el-table-column>
                    <el-table-column label="变更前值" show-overflow-tooltip width="140">
                        <template slot-scope="scope">{{ scope.row.oldFieldValue }}</template>
                    </el-table-column>
                    <el-table-column label="变更后值" show-overflow-tooltip width="140">
                        <template slot-scope="scope">{{ scope.row.newFieldValue }}</template>
                    </el-table-column>
                    <el-table-column :label="$t('label.grade')" prop="grade" show-overflow-tooltip></el-table-column>
                    <el-table-column :label="$t('label.college')" width="140" show-overflow-tooltip>
                        <template slot-scope="scope">{{ scope.row.facultyI18n }}</template>
                    </el-table-column>
                    <!-- <el-table-column
                        :label="$t('school.school')"
                        width="100"
                        show-overflow-tooltip
                        v-if="showSchool"
                        prop="schoolName"
                    ></el-table-column> -->
                    <el-table-column :label="$t('label.major')" width="140" show-overflow-tooltip>
                        <template slot-scope="scope">{{ scope.row.professionI18n }}</template>
                    </el-table-column>
                    <el-table-column
                        :label="$t('label.trainingLevel')"
                        width="120"
                        show-overflow-tooltip
                    >
                        <template slot-scope="scope">{{ scope.row.trainingLevelI18n }}</template>
                    </el-table-column>
                    <el-table-column
                        :label="$t('label.trainingCategory')"
                        width="140"
                        show-overflow-tooltip
                    >
                        <template slot-scope="scope">{{ scope.row.trainingCategoryI18n }}</template>
                    </el-table-column>
                    <el-table-column
                        :label="$t('label.degreeCategory')"
                        width="120"
                        show-overflow-tooltip
                    >
                        <template slot-scope="scope">{{ scope.row.degreeTypeI18n }}</template>
                    </el-table-column>
                    <el-table-column
                        :label="$t('label.formLearning')"
                        width="140"
                        show-overflow-tooltip
                    >
                        <template slot-scope="scope">{{ scope.row.formLearningI18n }}</template>
                    </el-table-column>
                    <el-table-column
                        :label="$t('label.enrolMethod')"
                        width="140"
                        show-overflow-tooltip
                    >
                        <template slot-scope="scope">{{ scope.row.enrolMethodsI18n }}</template>
                    </el-table-column>
                    <el-table-column
                        :label="$t('label.isOverseas')"
                        width="140"
                        show-overflow-tooltip
                    >
                        <template slot-scope="scope">
                            <el-tag
                                type="danger"
                                v-if="scope.row.isOverseas==0"
                            >{{scope.row.isOverseasI18n}}</el-tag>
                            <el-tag
                                type="success"
                                v-else-if="scope.row.isOverseas==1"
                            >{{scope.row.isOverseasI18n}}</el-tag>
                        </template>
                    </el-table-column>
                    <el-table-column label="审核状态" width="120" show-overflow-tooltip>
                        <template slot-scope="scope">{{ getCheckStatus(scope.row.approStatus) }}</template>
                    </el-table-column>
                    <el-table-column :label="$t('label.operation')" fixed="right" width="120">
                        <template slot-scope="scope">
                            <div>
                                <el-button
                                    v-if="showApproveBtn
                                    &&(scope.row.approStatus==4||scope.row.approStatus==5||scope.row.approStatus==6)
                                    &&scope.row.isApproved==0"
                                    type="text"
                                    @click="studentApprove(scope)"
                                >{{$t('message.Approval')}}</el-button>

                                <el-button
                                    type="text"
                                    @click="studentDetail(scope)"
                                >{{$t('message.detail')}}</el-button>

                                <el-button
                                    type="text"
                                    v-if="isStudent&&scope.row.isApproved==0"
                                    @click="handleRecall(scope.row)"
                                >{{$t('message.recall')}}</el-button>
                            </div>
                        </template>
                    </el-table-column>
                </edu-table>
            </el-card>
            <edu-dialog ref="checkDialog" title="批量审核" @close="closeCheckDialog" size="small">
                <el-form
                    label-suffix=":"
                    label-position="left"
                    label-width="100px"
                    ref="checkForm"
                    :model="checkForm"
                >
                    <el-row>
                        <el-col :span="24">
                            <el-form-item label="审批意见">
                                <el-input
                                    type="textarea"
                                    v-model="checkForm.msg"
                                    rows="4"
                                    maxlength="500"
                                ></el-input>
                            </el-form-item>
                        </el-col>
                    </el-row>
                </el-form>
                <template slot="buttons">
                    <el-button @click="backApprove">{{$t("message.return")}}</el-button>
                    <el-button @click="reject" type="danger">{{$t("message.noPass")}}</el-button>
                    <el-button @click="through" type="primary">{{$t("message.pass")}}</el-button>
                </template>
            </edu-dialog>
        </div>
        <fieldCheck
            v-if="indexKey=='2'||indexKey=='3'"
            :param-id="paramId"
            @change="changed"
            :isRecall="isRecall"
        />
    </div>
</template>
<script>
import { queryDic } from "common/src/api/dictionary";
import UTILS from "common/src/utils/utils";
import {
    fieldApprovalList,
    exportApprovalList,
    throughBatch,
    rejectBatch,
    retractApproval
} from "common/src/api/studentRegister";
import BPIs from "common/src/api/welcomeService/schoolRelation";
import { fieldType, fieldsByfieldType } from "common/src/api/studentinfo";
import fieldCheck from "./fieldCheck";
export default {
    name: "StuInfoCheckManage",
    components: {
        fieldCheck
    },
    data() {
        return {
            queryForm: {
                grade: null,
                facultyList: [],
                professionList: [],
                trainingLevelList: [],
                trainingCategory: null,
                degreeType: null,
                formLearning: null,
                enrolMethods: null,
                isOverseas: null,
                approStatus: null,
                fieldClass: null,
                appliType: null,
                keyWord: null,
                schoolId: null, //学堂
                fieldId: null,
                pageSize_: 20,
                pageNum_: 1,
                total_: 0
            },
            options: {
                college: [],
                major: [],
                trainingLevel: [],
                trainingCategory: [],
                degreeType: [],
                formLearning: [],
                isOverseas: [],
                enrolMethods: [],
                approStatus: [],
                fieldClass: [],
                fields: [],
                appliType: [],
                school: []
            },
            students: [],
            selectedStudents: [],
            showApproveBtn: false,
            checkForm: {
                msg: ""
            },
            allowCheck: ["4", "5", "6"], //允许审核的三种状态
            showSchool: false,
            indexKey: "1",
            breadPath: {
                label: "信息变更管理",
                key: "1",
                children: [
                    {
                        key: "2",
                        label: "审核"
                    },
                    {
                        key: "3",
                        label: "详情"
                    }
                ]
            },
            paramId: null,
            currentDptId: null,
            isStudent: false,
            studentIdList: null,
            isRecall: false
        };
    },
    created() {
        let session = localStorage.getItem("sessiondata");
        session = JSON.parse(session);
        let user = session.mockUser || session.user;
        //判断是否显示学堂
        this.currentDptId = user.currentManageDptId;
        this.isStudent = user.type == 2 ? true : false;
        if (user.currentManageDptId == 1) {
            this.showSchool = true;
            BPIs.findSchool({
                pageNum_: 0,
                pageSize_: 0,
                condition: {}
            }).then(res => {
                if (res.code == 200 && res.data.list.length > 0) {
                    for (const item of res.data.list) {
                        this.options.school.push({
                            label: item.name,
                            value: item.id
                        });
                    }
                }
            });
        }
        if (user.uid == "admin1") {
            return;
        }
        //1.管理员 2.教务员 3.导师 4.老师 5.留办老师 6.学生
        if (
            user.innerRoles.includes("1") ||
            user.innerRoles.includes("2") ||
            user.innerRoles.includes("5")
        ) {
            this.showApproveBtn = true;
        }
    },
    mounted() {
        this.init();
    },
    methods: {
        init() {
            let approStatus = [];
            approStatus.push({ label: "留办审核", value: "4" });
            approStatus.push({ label: "学院审核", value: "5" });
            approStatus.push({ label: "学校审核", value: "6" });
            approStatus.push({ label: "已审核", value: "3" });
            approStatus.push({ label: "驳回", value: "2" });
            approStatus.push({ label: "已撤销", value: "7" });
            let appliType = [
                { label: "院审", value: "1" },
                { label: "校审", value: "2" }
            ];
            this.options.approStatus = approStatus;
            this.options.appliType = appliType;
            let data = {
                lang: this.$store.getters.language || "cn",
                type: "allChild",
                keys: [
                    "X_PYCC",
                    "X_PYLB",
                    "X_YX",
                    "X_XWLX",
                    "X_XXXS",
                    "isAborad",
                    "X_RXFS"
                ]
            };
            queryDic(data).then(res => {
                if (res.code == 200) {
                    UTILS.fillSelect(
                        {
                            college: "X_YX",
                            trainingLevel: "X_PYCC",
                            formLearning: "X_XXXS",
                            trainingCategory: "X_PYLB",
                            isOverseas: "isAborad",
                            degreeType: "X_XWLX",
                            enrolMethods: "X_RXFS"
                        },
                        res.data,
                        this.options
                    );
                }
            });
            fieldType().then(res => {
                if (res.code == 200 && res.data) {
                    res.data.forEach(field => {
                        this.options.fieldClass.push({
                            label: field.name,
                            value: field.nameEn
                        });
                    });
                }
            });
            this.onSubmit();
        },
        onSubmit(isActiveTrigger = true, isFirstPage = true) {
            if (isFirstPage) {
                this.queryForm.pageNum_ = 1;
            }
            if (isActiveTrigger && this.studentIdList != null) {
                this.studentIdList = null;
            }
            let param = null;
            if (this.studentIdList) {
                param = {
                    studentIdList: this.studentIdList,
                    pageNum_: this.queryForm.pageNum_,
                    pageSize_: this.queryForm.pageSize_,
                    advanceType: 1
                };
            } else {
                param = this.queryForm;
            }
            fieldApprovalList(param).then(res => {
                if (res.code == 200) {
                    this.students = res.data.list;
                    this.queryForm.total_ = res.data.total_;
                }
            });
        },
        reset() {
            this.queryForm.grade = null;
            this.queryForm.facultyList = [];
            this.queryForm.professionList = [];
            this.queryForm.trainingLevelList = [];
            this.options.major = [];
            this.queryForm.trainingCategory = null;
            this.queryForm.degreeType = null;
            this.queryForm.formLearning = null;
            this.queryForm.enrolMethods = null;
            this.queryForm.isOverseas = null;
            this.queryForm.approStatus = null;
            this.queryForm.fieldClass = null;
            this.queryForm.appliType = null;
            this.queryForm.keyWord = null;
            this.queryForm.schoolId = null;
            this.queryForm.fieldId = null;
            this.options.fields.length = 0;
            this.onSubmit();
        },
        changeFaculty() {
            this.options.major = [];
            this.queryForm.professionList = [];
            if (
                this.currentDptId == "1" &&
                this.queryForm.facultyList.length == 0
            ) {
                return;
            }
            if (
                this.currentDptId != "1" &&
                this.queryForm.facultyList.length == 0 &&
                !this.queryForm.degreeType
            ) {
                return;
            }
            let degreeType = this.queryForm.degreeType
                ? [this.queryForm.degreeType]
                : [];
            const data = {
                lang: this.$store.getters.language || "cn",
                type: "allChild",
                keys: ["G_ZY"],
                filter: {
                    prefix: this.queryForm.facultyList,
                    specilaCode: "XY2ZY",
                    facultys: this.queryForm.facultyList,
                    grade: this.queryForm.grade,
                    degreeType: degreeType
                }
            };
            queryDic(data).then(res => {
                if (res.code === 200)
                    UTILS.fillSelect({ major: "G_ZY" }, res.data, this.options);
            });
        },
        handleCurrentChange(val) {
            this.queryForm.pageSize_ = val.pageSize;
            this.queryForm.pageNum_ = val.pageNum;
            this.onSubmit(false, false);
        },
        selectionChange(val) {
            this.selectedStudents = val;
        },
        //批量审核
        approve() {
            if (this.selectedStudents.length == 0) {
                this.$message({
                    type: "info",
                    message: this.$t("stuRegister.noSelectedStu")
                });
                return;
            }
            if (
                !this.selectedStudents.every(s =>
                    this.allowCheck.includes(s.approStatus)
                )
            ) {
                this.$message({
                    type: "info",
                    message: "选中项必须都是审核中状态"
                });
                return;
            }
            let status = this.selectedStudents[0].approStatus;
            if (this.selectedStudents.some(s => s.approStatus != status)) {
                this.$message({
                    type: "info",
                    message: "审核状态必须一致"
                });
                return;
            }
            status = this.selectedStudents[0].appliType;
            if (this.selectedStudents.some(s => s.appliType != status)) {
                this.$message({
                    type: "info",
                    message: "选中字段的审批类型不一致"
                });
                return;
            }
            if (this.selectedStudents.some(s => s.isApproved == 1)) {
                this.$message({
                    type: "info",
                    message: "选中项存在已审核的状态"
                });
                return;
            }
            this.$refs.checkDialog.open();
        },
        //导出
        exportStudents() {
            if (this.selectedStudents && this.selectedStudents.length > 0) {
                window.open(
                    exportApprovalList({
                        ids: this.selectedStudents.map(s => s.id)
                    })
                );
            } else {
                let queryForm = _.cloneDeep(this.queryForm);
                queryForm.pageSize_ = null;
                queryForm.pageNum_ = null;
                queryForm.total_ = null;
                queryForm.facultyList = null;
                queryForm.professionList = null;
                queryForm.trainingLevelList = null;
                //与后台接口参数不一致，这里转换参数
                if (this.queryForm.facultyList.length > 0) {
                    queryForm.facultys = this.queryForm.facultyList.join(",");
                }
                if (this.queryForm.professionList.length > 0) {
                    queryForm.professions = this.queryForm.professionList.join(
                        ","
                    );
                }
                if (this.queryForm.trainingLevelList.length > 0) {
                    queryForm.trainingLevels = this.queryForm.trainingLevelList.join(
                        ","
                    );
                }
                window.open(exportApprovalList(queryForm));
            }
        },
        //学生审批
        studentApprove(scope) {
            this.isRecall = scope.row.approStatus == 7 ? true : false;
            this.paramId = scope.row.workflowNo + "-" + scope.row.id + "-1";
            this.indexKey = "2";
        },
        //学生详情
        studentDetail(scope) {
            this.isRecall = scope.row.approStatus == 7 ? true : false;
            this.paramId = scope.row.workflowNo + "-" + scope.row.id + "-0";
            this.indexKey = "3";
        },
        closeCheckDialog() {
            this.checkForm.msg = "";
        },
        //批量审批返回
        backApprove() {
            this.$refs.checkDialog.close();
        },
        //批量审批通过
        through() {
            let data = this.selectedStudents.map(r => {
                return {
                    no: r.workflowNo,
                    content: this.checkForm.msg
                };
            });
            throughBatch(data).then(res => {
                if (res.code == 200) {
                    this.$message({
                        type: "success",
                        message: "批量审批通过"
                    });
                    this.$refs.checkDialog.close();
                    this.onSubmit(false, false);
                }
            });
        },
        //批量审批拒绝
        reject() {
            if (this.checkForm.msg == "" || this.checkForm.msg == null) {
                this.$message({
                    type: "warning",
                    message: "请填写审批意见"
                });
                return;
            }
            let data = this.selectedStudents.map(r => {
                return {
                    no: r.workflowNo,
                    content: this.checkForm.msg
                };
            });
            rejectBatch(data).then(res => {
                if (res.code == 200) {
                    this.$message({
                        type: "success",
                        message: "批量审批驳回"
                    });
                    this.$refs.checkDialog.close();
                    this.onSubmit(false, false);
                }
            });
        },
        saveCheckDialog() {},
        getIsOverseasLabel(val) {
            let label = null;
            if (val == 0) {
                label = "否";
            } else if (val == 1) {
                label = "是";
            }
            return label;
        },
        getCheckStatus(val) {
            let status = this.options.approStatus.find(a => a.value == val);
            return status ? status.label : null;
        },
        changed() {
            this.indexKey = "1";
            this.onSubmit(false, false);
        },
        //高级查询
        advanceQuery(data) {
            this.studentIdList = data;
            this.queryForm.pageNum_ = 1;
            let param = {
                studentIdList: data,
                pageNum_: this.queryForm.pageNum_,
                pageSize_: this.queryForm.pageSize_,
                advanceType: 1
            };
            fieldApprovalList(param).then(res => {
                if (res.code == 200) {
                    this.students = res.data.list;
                    this.queryForm.total_ = res.data.total_;
                }
            });
        },
        handleFieldClassChange(val) {
            if (val) {
                fieldsByfieldType(val).then(res => {
                    if (res.code == 200) {
                        this.options.fields = res.data.map(field => {
                            return {
                                label: field.name,
                                value: field.id
                            };
                        });
                    }
                });
            } else {
                this.options.fields.length = 0;
            }
        },
        handleRecall(entity) {
            retractApproval(entity).then(res => {
                if (res.code == 200) {
                    this.$message({
                        type: "success",
                        message: "撤回成功"
                    });
                    this.onSubmit();
                }
            });
        }
    }
};
</script>
<style lang="scss" scoped>
.condition {
    ::v-deep .el-select__tags {
        span span:only-child {
            text-overflow: ellipsis;
            overflow: hidden;
            width: 200px;
        }

        span span:nth-last-child(2) {
            text-overflow: ellipsis;
            overflow: hidden;
            width: 110px;
        }
        input {
            display: none;
        }
    }
}
</style>
